package org.jeecg.modules.hc.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.jeecg.modules.hc.entity.HcCommodity;
import org.jeecg.modules.hc.entity.HcMerchant;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Description: 商户
 * @Author: jeecg-boot
 * @Date:   2022-12-13
 * @Version: V1.0
 */
public interface IHcMerchantService extends IService<HcMerchant> {

    void setOpenId(String code, String userId) throws WxErrorException;

    void syncCommodityToRedis();

    /**
     * 根据商家id获取token
     * @param id
     * @return
     */
    HcMerchant getTokenById(String id);

    /**
     * 校验营业打烊并更新
     * @param param
     */
    void checkBusinessState(HcMerchant param);

    /**
     * 登录
     * @param phone
     * @param smsCode
     * @return
     */
    HcMerchant login(String phone, String pass);

    void setInformation(HcMerchant param);

    /**
     * 编辑商户
     * @param param
     */
    void edit(HcMerchant param);

    /**
     * 新增商户
     * @param param
     */
    void add(HcMerchant param);

    /**
     * 用户端根据商户id获取菜品
     * @param param
     * @return
     */
    List<HcCommodity> queryCommodityByMerchantId(HcMerchant param);

    /**
     * 根据主营品类获取商户和商品列表
     * @param page
     * @param param
     * @return
     */
    IPage<HcMerchant> getList(Page<HcMerchant> page, HcMerchant param);


    JSONObject transferToMerchant(String openId, BigDecimal amount, String outNo,String remarks) throws Exception;

    JSONObject transferToMerchant2000(String openId, BigDecimal amount, String outNo,String remarks,String userName) throws Exception;

    List<HcMerchant> getAllAutoSettleMerchant();

    Integer changeAutoSettle(String merchantId,Boolean autoSettle);

    Integer clearMerchantOpenId(String merchantId);
}
